﻿using Microsoft.Services.TestTools.UITesting.Html;
using Microsoft.VisualStudio.TestTools.UITesting;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Xml;
using System.Configuration;
using TestBing;

namespace CodedUITest
{

    [CodedUITest]
    public class TestSuite
    {
        private TestContext testContextInstance;
        private string siteURL = ConfigurationManager.AppSettings["SiteURL"];

        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        [DeploymentItem("Parameters.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\Parameters.xml", "Bing", DataAccessMethod.Sequential), TestMethod]
        public void TestBingSearch()
        {

            string textToSearch = TestContext.DataRow["TextToSearch"].ToString();

            Bing bing = Page.Launch<Bing>(siteURL);
            bing.TextToSearch = textToSearch;
            bing.Search(); 

        }

        

    }
}


